<?php
namespace app\route;
use app\api\controller\Collection\Collection;
use Webman\Route;
use app\common\controller\Upload;
use app\api\controller\Goods;
use app\api\controller\Cart;
use app\api\controller\Set;
use app\api\controller\User;
use app\api\controller\Want;

final class Api
{
    
    public static function handle()
    {
        Route::post('/upload' , [Upload::class , 'upload']);
        Route::group('/api' , function(){

        });
        static::user();//用户模块
        static::goods();//商品模块
        static::set();//设置模块
        static::cart();//购物车模块
        static::wantBuy();//种草模块
        static::collection();//收藏模块

    }

    /**
     * 用户模块
     */
    public static function user()
    {
        Route::group('/user' , function(){
            Route::post('/userLogin', [User\User::class, 'userLogin']);//账号密码登录
            Route::post('/mobileLogin', [User\User::class, 'mobileLogin']);//手机验证码登录
        });
    }

    /**
     * 设置模块
     */
    public static function set()
    {
        Route::group('/set' , function(){
            Route::get('/getBannerList', [Set\ModuleBanner::class, 'getBannerList']);//轮播图
            Route::get('/getNavClassifyList', [Set\NavSet::class, 'getNavClassifyList']);//导航分类列表
        });
    }


    /**
     * 商品模块
     */
    public static function goods()
    {
        Route::group('/goods' , function(){
            Route::get('/getGoodsList', [Goods\Goods::class, 'getGoodsList']);//随机、可根据用户的喜爱获取商品列表
            Route::get('/getGoodsSearchList', [Goods\Goods::class, 'getGoodsSearchList']);//获取商品详情（带搜索功能、可选是否为随机）
            Route::get('/detail', [Goods\Goods::class, 'getGoodsDetail']);//获取商品详情
        });

        Route::group('/goodsCategory' , function(){
            Route::get('/getGoodsCategoryList', [Goods\GoodsCategory::class, 'getGoodsCategoryList']);//获取商品分类列表
        });
    }

    /**
     * 购物车模块
     */
    public static function cart()
    {
        Route::group('/cart' , function(){
            Route::get('/getUserCartList', [Cart\Cart::class, 'getUserCartList']);//购物车列表
            Route::post('/addCart', [Cart\Cart::class, 'addCart']);//添加商品到购物车
            Route::post('/editCart', [Cart\Cart::class, 'editCart']);//编辑购物车
            Route::post('/deleteCart', [Cart\Cart::class, 'deleteCart']);//删除购物车
            Route::post('/clearCart', [Cart\Cart::class, 'clearCart']);//清空购物车
        });
    }

    /**
     * 种草模块
     */
    public static function wantBuy()
    {
        Route::group('/wantBuy' , function(){
            Route::get('/wantBuyUserList', [Want\WantBuy::class, 'wantBuyUserList']);//用户的种草列表
            Route::post('/publishAuditWantBuy', [Want\WantBuy::class, 'publishAuditWantBuy']);//发布种草信息
        });
    }


    /**
     * 收藏模块
     */
    public static function collection()
    {
        Route::group('/collection' , function(){
            Route::post('/goods', [Collection::class, 'goodsCollection']);// 收藏/取消收藏商品
        });
    }




}